package exam.business.service;

import exam.common.constant.ResultPort;
import exam.common.key.KeyUser;
import exam.model.dao.TUserDAO;
import exam.system.business.AbstractService;
import exam.system.business.BusinessServiceInfo;
/**
 * <p>UserChangePasswordService</p>
 * <p>Xử lý thay đổi mật khẩu người dùng</p>
 * 
 * @author Phong
 * @version 19/05/2012
 */
public class UserChangePasswordService extends AbstractService {
	TUserDAO tUserDAO = new TUserDAO();
	@Override
	public String executeService(BusinessServiceInfo serviceInfo)
			throws Exception {
		// TODO Auto-generated method stub
		String passwordOld = serviceInfo.getString(KeyUser.PASS_WORD_1);
		String passwordNew = serviceInfo.getString(KeyUser.PASS_WORD_2);
		int change = tUserDAO.changePassword(passwordOld, passwordNew);
		if(change == 0) {
			return ResultPort.FAIL;
		} else {
			return ResultPort.SUCCESS;
		}
	}

}
